package org.pangu.client.controller;

import java.util.Map;

import org.pangu.client.service.DeptService;
import org.pangu.common.Result;
import org.pangu.dto.ProductDTO;
import org.pangu.dto.UserDTO;
import org.pangu.vo.ProductVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {

	@Autowired
	private DeptService deptService;
	
	@GetMapping("/api/findProduct")
	public Result<ProductVO> findProduct(@RequestBody ProductDTO dto) {
		UserDTO userDTO = new UserDTO();
		userDTO.setName("zhangsan");
		dto.setUserDTO(userDTO);

		Result<ProductVO> target = deptService.getProduct(dto);
//		deptService.getProduct(dto);
		return target;
	}
	
	@GetMapping("/api/findProduct/generic")
	public Result<Map> findProductGeneric(@RequestBody ProductDTO dto) {
		Result<Map> target = deptService.getProductGenericCache(dto);
//		deptService.getProduct(dto);
		return target;
	}
}
